Re: novice question about NOTICE:...

Поиск
Список
Период
Сортировка
От Lloyd Vancil
Тема Re: novice question about NOTICE:...
Дата
Msg-id a05101035b8d12999c9e3@[17.207.13.64]
обсуждение исходный текст
Ответ на novice question about NOTICE:...  (Lloyd Vancil <lev@apple.com>)
Список pgsql-novice
Thanks Doug.
    But then it came up with
ERROR:  Column reference "oid" is ambiguous.
and eventually
ERROR:  Column reference "lang" is ambiguous
    because -every- table has an OID and in this case both tables have
a column 'lang'


so, correctly it is
select cgidat.oid, cgidat.lang from cgidat, tierdat where
cgidat.state = 'testing' and
cgidat.lang = tiredat.lang and
tierdat.tier = '0' order by lang;
And if you dont select lang then the order by has to be qualified too.


select cgidat.oid from cgidat, tierdat where
cgidat.state = 'testing' and
cgidat.lang = tiredat.lang and
tierdat.tier = '0' order by cgidat.lang;

At 12:55 PM -0800 4/3/02, Doug Silver wrote:
>
>That was mighty nice of Postgres to fix your query -- I didn't know it
>would do that.  You're doing a join from two tables, cgidat and tierdat,
>so you must include them in your FROM clause:
>
>select oid, lang from cgidat, tierdat where
>cgidat.state = 'testing' and
>cgidat.lang = tiredat.lang and
>tierdat.tier = '0' order by lang;
>
>or using aliases (a must when you start joining several tables):
>
>select c.oid,c.lang from cgidat c, tierdat t where
>c.state='testing' and
>c.lang = t.lang and
>t.tier ='0' order by c.lang

--
searchmaster@apple.com
                 lev@apple.com

В списке pgsql-novice по дате отправления:

Предыдущее
От: Doug Silver
Дата:
Сообщение: Re: novice question about NOTICE:...
Следующее
От: "Morrison, Trevor (Trevor)"
Дата:
Сообщение: FW: readline and psql